import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
  HomePage();

  @override
  _HomePageState createState () => _HomePageState();
}
 class _HomePageState extends State<HomePage>  {

  int _selectedIndex = 0;

  final Color _selectedColor = Colors.blue;
  final Color _unselectedColor = Colors.black;

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('首页'),
      ),
      body: Text('hello world'),
      bottomNavigationBar: BottomNavigationBar(
        items: <BottomNavigationBarItem>[
          BottomNavigationBarItem(
            title: Text(
              '首页',
            ),
            icon: Icon(
              Icons.home,
              color: _unselectedColor,
            ),
            activeIcon: Icon(
              Icons.home,
              color: _selectedColor,
            ),
          ),
          BottomNavigationBarItem(
            title: Text(
              '精华',
            ),
            icon: Icon(
              Icons.access_alarms,
              color: _unselectedColor,
            ),
            activeIcon: Icon(
              Icons.access_alarms,
              color: _selectedColor,
            ),
          ),
          BottomNavigationBarItem(
            title: Text(
              '分享',
            ),
            icon: Icon(
              Icons.access_alarms,
              color: _unselectedColor,
            ),
            activeIcon: Icon(
              Icons.access_alarms,
              color:_selectedColor,
            ),
          ),
          BottomNavigationBarItem(
            title: Text(
              '问答',
            ),
            icon: Icon(
              Icons.access_alarms,
              color: _unselectedColor,
            ),
            activeIcon: Icon(
              Icons.access_alarms,
              color: _selectedColor,
            ),
          ),
          BottomNavigationBarItem(
            title: Text(
              '招聘',
            ),
            icon: Icon(
              Icons.access_alarms,
              color: _unselectedColor,
            ),
            activeIcon: Icon(
              Icons.access_alarms,
              color: _selectedColor,
            ),
          ),
        ],
        iconSize: 24,
        currentIndex: _selectedIndex,
        onTap: _onItemTapped,
        fixedColor: _selectedColor,
        type: BottomNavigationBarType.fixed,
      ),
    );
  }
 }
